GCC detect 32 or 64 bit system
For example:
#include <iostream> #if __x86_64__ #define ENV64BIT #else #define ENV32BIT #endif using namespace std; int main() { #ifdef ENV64BIT cout << "64 bit" << endl; #endif #ifdef ENV32BIT cout << "32 bit" << endl; #endif }